// 类型主题
const typeTheme = {

    'bar': {
        legend: {
            type: 'scroll'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        yAxis: [{
            type: 'value',
            splitLine: {
                lineStyle: {
                    type: 'dotted'
                }
            }
        }]
    },

    'line': {
        legend: {
            type: 'scroll'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross'
            }
        },

        yAxis: {
            type: 'value',
            splitLine: {
                lineStyle: {
                    type: 'dotted'
                }
            }
        }
    },

    'pie': {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}：{c}"
        }
    },

    'radar': {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            },
        }
    },

    'gauge': {
        tooltip: {
            formatter: "{a} <br/>{b} : {c}"
        }
    },

    'toolbox': {
        toolbox: {
            show: true,
            right: '20',
            iconStyle: {
                borderColor: '#303133',
                borderWidth: 1.5
            },
            feature: {
                saveAsImage: { type: 'png' }
            }
        }
    }
}

const option = (options = {}, ...types) => {
    let _typeTheme = {};
    _.forEach(types, type => {
        _.merge(_typeTheme, typeTheme[type] || {});
    });
    return _.merge({}, _typeTheme, options);
}

export default option;